\hypertarget{classPVT__Ctr}{}\doxysection{P\+V\+T\+\_\+\+Ctr Class Reference}
\label{classPVT__Ctr}\index{PVT\_Ctr@{PVT\_Ctr}}


This class implemented a position and velocity based low-\/level PD motor controller.  




{\ttfamily \#include $<$P\+V\+T\+\_\+ctrl.\+h$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classPVT__Ctr_a471dd413e1e95bbe91e218e1ea611a6f}{P\+V\+T\+\_\+\+Ctr}} (double time\+Step\+In, const char $\ast$json\+Path)
\begin{DoxyCompactList}\small\item\em Construct a new pvt ctr object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_a59c9680162b5ef4bd67553b4eadcd5de}{cal\+Motors\+P\+VT}} ()
\begin{DoxyCompactList}\small\item\em calculate the motors torque \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_abf75859d36e4319b658748e35c40c2c0}{cal\+Motors\+P\+VT}} (double delta\+P\+\_\+\+Lim)
\begin{DoxyCompactList}\small\item\em calculate the motors torque with delta position limit \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_a29f1c739eec92db4f83ba0a1fdb53367}{enable\+PV}} ()
\begin{DoxyCompactList}\small\item\em enable PV control item for all the joints \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_ae17e60bb77cff1eee387ba7681f552d0}{disable\+PV}} ()
\begin{DoxyCompactList}\small\item\em disable PV control item for all the joints \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_ae18b2ffdd1d2198450698dc89af3425d}{enable\+PV}} (int jt\+Id)
\begin{DoxyCompactList}\small\item\em enable PV control item for specific joint \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_a31ece05e6fe09c2ac4df3265e84a6d75}{disable\+PV}} (int jt\+Id)
\begin{DoxyCompactList}\small\item\em disable PV control item for specific joint \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_a9043bcd372772fda34a4a3d8b6ff96ee}{set\+Joint\+PD}} (double kp, double kd, const char $\ast$joint\+Name)
\begin{DoxyCompactList}\small\item\em Set the Joint P D gain. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_a596b859183cef9466234053260d05185}{data\+Bus\+Read}} (\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&bus\+In)
\begin{DoxyCompactList}\small\item\em read necessary data from databus \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classPVT__Ctr_a50946a0747c3b2c5a44693e0efa07b83}{data\+Bus\+Write}} (\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&bus\+In)
\begin{DoxyCompactList}\small\item\em write the updated data to databus \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classPVT__Ctr_a65bea7c1cf6efd9779fafb9530542b5a}\label{classPVT__Ctr_a65bea7c1cf6efd9779fafb9530542b5a}} 
int \mbox{\hyperlink{classPVT__Ctr_a65bea7c1cf6efd9779fafb9530542b5a}{joint\+Num}}
\begin{DoxyCompactList}\small\item\em number of joints \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_aa7ffa78b4deff2ded61d871605d04820}\label{classPVT__Ctr_aa7ffa78b4deff2ded61d871605d04820}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_aa7ffa78b4deff2ded61d871605d04820}{motor\+\_\+pos\+\_\+cur}}
\begin{DoxyCompactList}\small\item\em all current motors position \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_a92dc261978c8606d77f190ea395023a5}\label{classPVT__Ctr_a92dc261978c8606d77f190ea395023a5}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_a92dc261978c8606d77f190ea395023a5}{motor\+\_\+pos\+\_\+des\+\_\+old}}
\begin{DoxyCompactList}\small\item\em last all desired motors position \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_a9d77dccb170f7a4b1ecf173b91047ba4}\label{classPVT__Ctr_a9d77dccb170f7a4b1ecf173b91047ba4}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_a9d77dccb170f7a4b1ecf173b91047ba4}{motor\+\_\+vel}}
\begin{DoxyCompactList}\small\item\em all current motors velocity \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_af96ebbc7d163601d831ca6fbdec2f8a1}\label{classPVT__Ctr_af96ebbc7d163601d831ca6fbdec2f8a1}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_af96ebbc7d163601d831ca6fbdec2f8a1}{motor\+\_\+tor\+\_\+out}}
\begin{DoxyCompactList}\small\item\em final tau output, the real desired torque exerted by the motor \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_a86bed2b218438e82e07858019af6eb12}\label{classPVT__Ctr_a86bed2b218438e82e07858019af6eb12}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_a86bed2b218438e82e07858019af6eb12}{motor\+\_\+pos\+\_\+des}}
\begin{DoxyCompactList}\small\item\em all desired motors position \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_a5624aa8616b716c07dbd15ccb97f81df}\label{classPVT__Ctr_a5624aa8616b716c07dbd15ccb97f81df}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_a5624aa8616b716c07dbd15ccb97f81df}{motor\+\_\+vel\+\_\+des}}
\begin{DoxyCompactList}\small\item\em all desired motors velocity \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_acbd741b868f4b6c28b8968bee46ca65c}\label{classPVT__Ctr_acbd741b868f4b6c28b8968bee46ca65c}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_acbd741b868f4b6c28b8968bee46ca65c}{motor\+\_\+tor\+\_\+des}}
\begin{DoxyCompactList}\small\item\em all desired motors torque \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_a087f2c0d307a08d0ca7a535e8d72e2df}\label{classPVT__Ctr_a087f2c0d307a08d0ca7a535e8d72e2df}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_a087f2c0d307a08d0ca7a535e8d72e2df}{pvt\+\_\+\+Kp}}
\begin{DoxyCompactList}\small\item\em kp gains of the motors \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_a94d3bed472c408dcf2f5f63d63f04ba3}\label{classPVT__Ctr_a94d3bed472c408dcf2f5f63d63f04ba3}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_a94d3bed472c408dcf2f5f63d63f04ba3}{pvt\+\_\+\+Kd}}
\begin{DoxyCompactList}\small\item\em kd gains of the motors \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_aa4041b56d20aeec8f7f4a07694530272}\label{classPVT__Ctr_aa4041b56d20aeec8f7f4a07694530272}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_aa4041b56d20aeec8f7f4a07694530272}{max\+Tor}}
\begin{DoxyCompactList}\small\item\em max torque limit of the motors \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_afb0b7dccfc83f7595d2f382b11b32b18}\label{classPVT__Ctr_afb0b7dccfc83f7595d2f382b11b32b18}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_afb0b7dccfc83f7595d2f382b11b32b18}{max\+Vel}}
\begin{DoxyCompactList}\small\item\em max velocity limit of the motors \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_acab0c63a484d70566ce74898da9a1fb8}\label{classPVT__Ctr_acab0c63a484d70566ce74898da9a1fb8}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_acab0c63a484d70566ce74898da9a1fb8}{max\+Pos}}
\begin{DoxyCompactList}\small\item\em max position limit of the motors \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classPVT__Ctr_ada55b04b5f69ea0e0a69d9fdb45fe853}\label{classPVT__Ctr_ada55b04b5f69ea0e0a69d9fdb45fe853}} 
std\+::vector$<$ double $>$ \mbox{\hyperlink{classPVT__Ctr_ada55b04b5f69ea0e0a69d9fdb45fe853}{min\+Pos}}
\begin{DoxyCompactList}\small\item\em min position limit of the motors \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This class implemented a position and velocity based low-\/level PD motor controller. 



Definition at line 22 of file P\+V\+T\+\_\+ctrl.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classPVT__Ctr_a471dd413e1e95bbe91e218e1ea611a6f}\label{classPVT__Ctr_a471dd413e1e95bbe91e218e1ea611a6f}} 
\index{PVT\_Ctr@{PVT\_Ctr}!PVT\_Ctr@{PVT\_Ctr}}
\index{PVT\_Ctr@{PVT\_Ctr}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{PVT\_Ctr()}{PVT\_Ctr()}}
{\footnotesize\ttfamily P\+V\+T\+\_\+\+Ctr\+::\+P\+V\+T\+\_\+\+Ctr (\begin{DoxyParamCaption}\item[{double}]{time\+Step\+In,  }\item[{const char $\ast$}]{json\+Path }\end{DoxyParamCaption})}



Construct a new pvt ctr object. 


\begin{DoxyParams}{Parameters}
{\em time\+Step\+In} & control timestep \\
\hline
{\em json\+Path} & the json file path storing the config of motors \\
\hline
\end{DoxyParams}


Definition at line 11 of file P\+V\+T\+\_\+ctrl.\+cpp.



References joint\+Num, max\+Pos, max\+Tor, max\+Vel, min\+Pos, motor\+\_\+pos\+\_\+cur, motor\+\_\+pos\+\_\+des\+\_\+old, motor\+\_\+tor\+\_\+out, motor\+\_\+vel, pvt\+\_\+\+Kd, and pvt\+\_\+\+Kp.



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classPVT__Ctr_a59c9680162b5ef4bd67553b4eadcd5de}\label{classPVT__Ctr_a59c9680162b5ef4bd67553b4eadcd5de}} 
\index{PVT\_Ctr@{PVT\_Ctr}!calMotorsPVT@{calMotorsPVT}}
\index{calMotorsPVT@{calMotorsPVT}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{calMotorsPVT()}{calMotorsPVT()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::cal\+Motors\+P\+VT (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



calculate the motors torque 



Definition at line 76 of file P\+V\+T\+\_\+ctrl.\+cpp.



References joint\+Num, max\+Tor, motor\+\_\+pos\+\_\+cur, motor\+\_\+pos\+\_\+des, motor\+\_\+pos\+\_\+des\+\_\+old, motor\+\_\+tor\+\_\+des, motor\+\_\+tor\+\_\+out, motor\+\_\+vel, motor\+\_\+vel\+\_\+des, pvt\+\_\+\+Kd, and pvt\+\_\+\+Kp.

\mbox{\Hypertarget{classPVT__Ctr_abf75859d36e4319b658748e35c40c2c0}\label{classPVT__Ctr_abf75859d36e4319b658748e35c40c2c0}} 
\index{PVT\_Ctr@{PVT\_Ctr}!calMotorsPVT@{calMotorsPVT}}
\index{calMotorsPVT@{calMotorsPVT}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{calMotorsPVT()}{calMotorsPVT()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::cal\+Motors\+P\+VT (\begin{DoxyParamCaption}\item[{double}]{delta\+P\+\_\+\+Lim }\end{DoxyParamCaption})}



calculate the motors torque with delta position limit 


\begin{DoxyParams}{Parameters}
{\em delta\+P\+\_\+\+Lim} & the largest position increment for the motor \\
\hline
\end{DoxyParams}


Definition at line 90 of file P\+V\+T\+\_\+ctrl.\+cpp.



References joint\+Num, max\+Tor, motor\+\_\+pos\+\_\+cur, motor\+\_\+pos\+\_\+des, motor\+\_\+pos\+\_\+des\+\_\+old, motor\+\_\+tor\+\_\+des, motor\+\_\+tor\+\_\+out, motor\+\_\+vel, motor\+\_\+vel\+\_\+des, pvt\+\_\+\+Kd, and pvt\+\_\+\+Kp.

\mbox{\Hypertarget{classPVT__Ctr_a596b859183cef9466234053260d05185}\label{classPVT__Ctr_a596b859183cef9466234053260d05185}} 
\index{PVT\_Ctr@{PVT\_Ctr}!dataBusRead@{dataBusRead}}
\index{dataBusRead@{dataBusRead}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{dataBusRead()}{dataBusRead()}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::data\+Bus\+Read (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&}]{bus\+In }\end{DoxyParamCaption})}



read necessary data from databus 


\begin{DoxyParams}{Parameters}
{\em bus\+In} & databus object storing the data \\
\hline
\end{DoxyParams}


Definition at line 46 of file P\+V\+T\+\_\+ctrl.\+cpp.



References joint\+Num, motor\+\_\+pos\+\_\+cur, motor\+\_\+pos\+\_\+des, motor\+\_\+tor\+\_\+des, motor\+\_\+vel, motor\+\_\+vel\+\_\+des, Data\+Bus\+::motors\+\_\+pos\+\_\+cur, Data\+Bus\+::motors\+\_\+pos\+\_\+des, Data\+Bus\+::motors\+\_\+tor\+\_\+des, Data\+Bus\+::motors\+\_\+vel\+\_\+cur, and Data\+Bus\+::motors\+\_\+vel\+\_\+des.

\mbox{\Hypertarget{classPVT__Ctr_a50946a0747c3b2c5a44693e0efa07b83}\label{classPVT__Ctr_a50946a0747c3b2c5a44693e0efa07b83}} 
\index{PVT\_Ctr@{PVT\_Ctr}!dataBusWrite@{dataBusWrite}}
\index{dataBusWrite@{dataBusWrite}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{dataBusWrite()}{dataBusWrite()}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::data\+Bus\+Write (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&}]{bus\+In }\end{DoxyParamCaption})}



write the updated data to databus 


\begin{DoxyParams}{Parameters}
{\em bus\+In} & databus object storing the data \\
\hline
\end{DoxyParams}


Definition at line 57 of file P\+V\+T\+\_\+ctrl.\+cpp.



References motor\+\_\+tor\+\_\+out, Data\+Bus\+::motors\+\_\+tor\+\_\+cur, and Data\+Bus\+::motors\+\_\+tor\+\_\+out.

\mbox{\Hypertarget{classPVT__Ctr_ae17e60bb77cff1eee387ba7681f552d0}\label{classPVT__Ctr_ae17e60bb77cff1eee387ba7681f552d0}} 
\index{PVT\_Ctr@{PVT\_Ctr}!disablePV@{disablePV}}
\index{disablePV@{disablePV}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{disablePV()}{disablePV()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::disable\+PV (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



disable PV control item for all the joints 



Definition at line 124 of file P\+V\+T\+\_\+ctrl.\+cpp.



References joint\+Num.

\mbox{\Hypertarget{classPVT__Ctr_a31ece05e6fe09c2ac4df3265e84a6d75}\label{classPVT__Ctr_a31ece05e6fe09c2ac4df3265e84a6d75}} 
\index{PVT\_Ctr@{PVT\_Ctr}!disablePV@{disablePV}}
\index{disablePV@{disablePV}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{disablePV()}{disablePV()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::disable\+PV (\begin{DoxyParamCaption}\item[{int}]{jt\+Id }\end{DoxyParamCaption})}



disable PV control item for specific joint 


\begin{DoxyParams}{Parameters}
{\em jt\+Id} & joint PV control to be disabled \\
\hline
\end{DoxyParams}


Definition at line 128 of file P\+V\+T\+\_\+ctrl.\+cpp.

\mbox{\Hypertarget{classPVT__Ctr_a29f1c739eec92db4f83ba0a1fdb53367}\label{classPVT__Ctr_a29f1c739eec92db4f83ba0a1fdb53367}} 
\index{PVT\_Ctr@{PVT\_Ctr}!enablePV@{enablePV}}
\index{enablePV@{enablePV}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{enablePV()}{enablePV()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::enable\+PV (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



enable PV control item for all the joints 



Definition at line 115 of file P\+V\+T\+\_\+ctrl.\+cpp.



References joint\+Num.

\mbox{\Hypertarget{classPVT__Ctr_ae18b2ffdd1d2198450698dc89af3425d}\label{classPVT__Ctr_ae18b2ffdd1d2198450698dc89af3425d}} 
\index{PVT\_Ctr@{PVT\_Ctr}!enablePV@{enablePV}}
\index{enablePV@{enablePV}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{enablePV()}{enablePV()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::enable\+PV (\begin{DoxyParamCaption}\item[{int}]{jt\+Id }\end{DoxyParamCaption})}



enable PV control item for specific joint 


\begin{DoxyParams}{Parameters}
{\em jt\+Id} & joint PV control to be enabled \\
\hline
\end{DoxyParams}


Definition at line 119 of file P\+V\+T\+\_\+ctrl.\+cpp.

\mbox{\Hypertarget{classPVT__Ctr_a9043bcd372772fda34a4a3d8b6ff96ee}\label{classPVT__Ctr_a9043bcd372772fda34a4a3d8b6ff96ee}} 
\index{PVT\_Ctr@{PVT\_Ctr}!setJointPD@{setJointPD}}
\index{setJointPD@{setJointPD}!PVT\_Ctr@{PVT\_Ctr}}
\doxysubsubsection{\texorpdfstring{setJointPD()}{setJointPD()}}
{\footnotesize\ttfamily void P\+V\+T\+\_\+\+Ctr\+::set\+Joint\+PD (\begin{DoxyParamCaption}\item[{double}]{kp,  }\item[{double}]{kd,  }\item[{const char $\ast$}]{joint\+Name }\end{DoxyParamCaption})}



Set the Joint P D gain. 


\begin{DoxyParams}{Parameters}
{\em kp} & position gain \\
\hline
{\em kd} & velocity gain \\
\hline
{\em joint\+Name} & the name of the joint \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
motor\+Name 
\end{DoxySeeAlso}


Definition at line 62 of file P\+V\+T\+\_\+ctrl.\+cpp.



References pvt\+\_\+\+Kd, and pvt\+\_\+\+Kp.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
P\+V\+T\+\_\+ctrl.\+h\item 
P\+V\+T\+\_\+ctrl.\+cpp\end{DoxyCompactItemize}
